import React from 'react';
import {
    View,
    Text,
    Image,
    TouchableOpacity,
} from 'react-native';

export default class ViewUtils{

    /**
     * 获取返回按钮
     * @param {回调方法} callBack 
     */
    static getLeftButton(callBack) {
        return <TouchableOpacity
            style={{padding: 8}}
            onPress={callBack}>
            <Image
                style={{width: 22, height: 22,}}
                source={require('../../res/image/arrow_left.png')}/>
        </TouchableOpacity>
    }

    /**
     * 获取右边的按钮
     * 文字
     * 回调方法
     */
    static getRightButton(title, callBack) {
        return <TouchableOpacity
            style={{alignItems: 'center',}}
            onPress={callBack}>
            <View style={{marginRight: 10}}>
                <Text style={{fontSize: 18, color: '#FFFFFF',}}>{title}</Text>
            </View>
        </TouchableOpacity>
    }

    /**
     * 获取更多按钮
     * @param callBack
     * @returns {XML}
     */
    static getMoreButton(callBack) {
        return <TouchableHighlight
            underlayColor={'transparent'}
            ref="moreMenuButton"
            style={{padding: 5}}
            onPress={callBack}
        >
            <View style={{paddingRight: 8}}>
                <Image
                    style={{width: 22, height: 22,}}
                    source={require('../../res/image/arrow_left.png')}
                />
            </View>
        </TouchableHighlight>
    }
}